# 先运行TCP服务器端，新python打开TCP客户端，模拟实现服务器与客户端的交互

# import socket
#
# # 创建socket对象
# client_socket = socket.socket()
# # IP地址和主机端口
# ip = '127.0.0.1'
# port = 8888
# client_socket.connect((ip, port))
# print('服务器连接建立成功')
#
# # 发送数据
# client_socket.send('Welcome to python world'.encode('utf-8'))
#
# # 接收来自服务器的数据
# data = client_socket.recv(1024).decode('utf-8')
# print('客户端发送过来的数据为：', data)
#
# # 关闭
# client_socket.close()
# print('发送完毕')